home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
kermit.columbia.edu
/
kermit.columbia.edu.tar
/
kermit.columbia.edu
/
newsgroups
/
misc.20020314-20021006
/
000056_fdc@columbia.edu_Sat Apr 27 11:47:43 EDT 2002.msg
< prev
next >
Wrap
Text File
|
2002-10-06
|
3KB
|
66 lines
Article: 13347 of comp.protocols.kermit.misc
Path: newsmaster.cc.columbia.edu!news.columbia.edu!news-not-for-mail
From: fdc@columbia.edu (Frank da Cruz)
Newsgroups: comp.unix.programmer,comp.protocols.kermit.misc
Subject: Re: serial port programming
Date: 27 Apr 2002 11:46:55 -0400
Organization: Columbia University
Lines: 49
Message-ID: <aaeh5f$4fc$1@watsol.cc.columbia.edu>
References: <4789aa76.0204270447.6f0a8436@posting.google.com>
NNTP-Posting-Host: watsol.cc.columbia.edu
X-Trace: newsmaster.cc.columbia.edu 1019922416 566 128.59.39.139 (27 Apr 2002 15:46:56 GMT)
X-Complaints-To: postmaster@columbia.edu
NNTP-Posting-Date: 27 Apr 2002 15:46:56 GMT
Xref: newsmaster.cc.columbia.edu comp.unix.programmer:145396 comp.protocols.kermit.misc:13347
In article <4789aa76.0204270447.6f0a8436@posting.google.com>,
Tomas <t.camin@libero.it> wrote:
: I'm trying to send some binary data through the serial port to a
: microcontroller asyncronously.
:
: I found a lot of informations on how to send characters but not binary
: data.
:
: Is it possible to do this?
:
Yes, you can use C-Kermit:
http://www.columbia.edu/kermit/ckermit.html
If the microcontroller supports Kermit protocol, you're done. If not...
C-Kermit includes a TRANSMIT command to send a file "bare" out the selected
communication device or network connection, even a binary file:
set modem type none
set port /dev/ttyS0
set speed 57600 ; or whatever
set flow rts/cts ; if possible -- xon/xoff can't be used here
transmit /binary /noecho /nowait <filename>
Now the question is: how does the microcontroller know when the transmission
is finished, when any byte sequence at all might be found in the file data?
Only you know the answer to that question. In one common scenario, the
device accepts data until a certain interval of "silence" has passed. In
another, the sender "hangs up" the connection by dropping DTR. In Kermit
this would be done with:
set modem hangup dtr
hangup
If this sequence doesn't work, the speed, flow, and various other parameters
can be adjusted until it does.
The technique described here is used with increasing frequency to load image,
audio, or video data into players or recorders. Obviously it requires a
clean, transparent, error-free connnection; otherwise you need an error-
detecting and correcting protocol (such as Kermit).
By the way, you don't want to program this kind of thing yourself in C.
Serial-port programming is quite tricky and totally nonportable. Each
release of each Unix variation (Linux, *BSD, Solaris, HP-UX, AIX, etc) is
different. That's why it's a good idea to use software whose job it is
to keep up with all this so you don't have to.
- Frank